//
//  NSTimer+My.m
//  My00
//
//  Created by 黄杰 on 15/2/4.
//  Copyright (c) 2015年 黄杰. All rights reserved.
//

#import "NSTimer+My.h"

@implementation NSTimer (My)
+ (instancetype)eoc_scheduledTimerWithTimeInterval:(NSTimeInterval)interval
                                     block:(void(^)())block
                                   repeats:(BOOL)repeats
{
    return [self scheduledTimerWithTimeInterval:interval
                                         target:self
                                       selector:@selector(eoc_blockInvoke:)
                                       userInfo:[block copy]
                                        repeats:repeats];
}

+ (void)eoc_blockInvoke:(NSTimer*)timer {
    void (^block)() = timer.userInfo;
    if (block) {
        block();
    }
}
@end
